<template>
  <div>
    <button 
      v-if="$route.query.type=='tghd'&&$route.query.istghd=='false'" 
      type="button"
      class="mui-btn mui-btn-primary bottombtn" 
      @click="goregister">立即报名</button>
    <button 
      v-if="$route.query.type=='tghd'&&$route.query.istghd=='true'&&$route.query.from=='活动'" 
      type="button"
      readonly
      class="mui-btn mui-btn-success bottombtn" 
    >活动已报名</button>
    <div>
      <iframe 
        id="myrame" 
        :src="framesrc" 
        name="myiframe" 
        frameborder="0" 
        align="left" 
        width="100%"
        height="100%" 
        scrolling="no"/>
    </div>

    <div 
      v-if="$route.query.istghd=='true'" 
      class="infodiv">
      <p>报名信息</p>
      <p>姓名 ：{{ rginfo.name }}</p>
      <p>性别 ：{{ rginfo.sex }}</p>
      <p>年龄 ：{{ rginfo.age }}</p>
      <p>身份证 ：{{ rginfo.idno }}</p>
      <p>手机号 ：{{ rginfo.phone }}</p>
      <p>已缴费 ：<b style="color:#f60">{{ rginfo.money }}</b>元</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ts: this.newStore(),
      rginfo: {},
      framesrc:
        'http://192.168.1.200:81/Home/Newindex/newDetail' +
        '?token=' +
        this.$route.query.token +
        '&id=' +
        this.$route.query.id
    }
  },
  created() {
    if (this.$route.query.istghd == 'true') {
      this.getrginfo()
    }
    console.log(this.$route.query.type)
  },
  layout: 'default2',
  methods: {
    goregister() {
      this.$router.push({
        name: 'fregister',
        query: {
          from: '活动详情',
          word: '缴费报名',
          id: this.$route.query.id
        }
      })
    },
    getrginfo() {
      const req = {
        token: localStorage.getItem('token'),
        id: this.$route.query.id
      }
      this.spost(this.ts, '/Newindex/mySignDetail', req).then(ts => {
        this.rginfo = ts.d.data
      })
    }
  }
}
</script>

<style>
.bottombtn {
  position: fixed;
  padding: 10px;
  width: 100%;
  bottom: 0;
}
.infodiv {
  padding: 10px;
  clear: both;
  width: 96%;
  margin: 0 auto;
  background: #f0f0f0;
  border-radius: 5px;
}
.infodiv p {
  line-height: 16px;
  padding-left: 10px;
}
.infodiv p:first-child {
  line-height: 30px;
  padding-left: 0;
  color: #333;
  font-size: 16px;
}
</style>
